go でのモジュール管理について(go.mod)
Go 1.16 以降
Go1.16からの go get と go install について - Qiita
Go 1.16 Release note
これで良いんだよな自分で翻訳しなくて
Go 1.16 リリースノート 日本語訳 - Qiita
Go 1.16 から go install が追加された
go get は go.mod を編集するためのもの
go install はバイナリビルドとインストールのためのもの
らしい
ツールのグローバルインストールには
go install <package>@<version> を利用する
e.g. go install golang.org/x/tools/gopls@latest
go get は go mod を編集するだけのコマンドになった
これまで go get は GOPATH/bin へのインストールも含まれていた
GO111MODULE=off go get ... みたいな
でも、今後は go install でよい
ぶっちゃけgo get の後に何が起きているかわからない人! - Qiita
でだいたいわかったけど、 go mod vendor は?
脱初心者Gopherのための言語仕様Tips - Qiita
go 1.14 移行は、グローバルなやつ(module cache)より、vendor が優先されるらしい
多分 go install だとグローバルな領域にインストールされるが、
go mod vendor だと、ローカルな領域にインストールされるということだろうか
Go 1.16 から(1.15だっけ?) go install がバージョン管理に対応したので、 go install でも基本は問題ない
vagrant や docker で開発していて、IDEを使っていて、Docker とホストPCの間で install の状況を共有したい場合には vendor を使うと良いのだろうか
たんに go と入れた時のヘルプ
code:sh
Go is a tool for managing Go source code.
Usage:
The commands are:
bug start a bug report
build compile packages and dependencies
clean remove object files and cached files
doc show documentation for package or symbol
env print Go environment information
fix update packages to use new APIs
fmt gofmt (reformat) package sources
generate generate Go files by processing source
get add dependencies to current module and install them
install compile and install packages and dependencies
list list packages or modules
mod module maintenance
run compile and run Go program
test test packages
tool run specified go tool
version print Go version
vet report likely mistakes in packages
Use "go help <command>" for more information about a command.
Additional help topics:
buildconstraint build constraints
buildmode build modes
c calling between Go and C
cache build and test caching
environment environment variables
filetype file types
go.mod the go.mod file
gopath GOPATH environment variable
gopath-get legacy GOPATH go get
goproxy module proxy protocol
importpath import path syntax
modules modules, module versions, and more
module-get module-aware go get
module-auth module authentication using go.sum
packages package lists and patterns
private configuration for downloading non-public code
testflag testing flags
testfunc testing functions
vcs controlling version control with GOVCS
Use "go help <topic>" for more information about that topic.